#ifndef KEYBOARD_H  // 如果 KEYBOARD_H 未定义，则继续
#define KEYBOARD_H

#include "main.h"
#include "user.h"
#include <map>
#include <string>
#include <tuple>

// 枚举类定义
/*
    按键宽60，高40，按键距离68
*/

// 数字键盘区域边界:按键宽60，高40，按键距离68
enum class NumKeys 
{
    N1_MIN_X = 62,   N1_MAX_X = 122,
    N1_MIN_Y = 255, N1_MAX_Y = 295,

    N2_MIN_X = 130,  N2_MAX_X = 190,
    N2_MIN_Y = 255, N2_MAX_Y = 295,

    N3_MIN_X = 198,  N3_MAX_X = 258,
    N3_MIN_Y = 255, N3_MAX_Y = 295,

    N4_MIN_X = 266, N4_MAX_X = 326,
    N4_MIN_Y = 255, N4_MAX_Y = 295,

    N5_MIN_X = 334, N5_MAX_X = 394,
    N5_MIN_Y = 255, N5_MAX_Y = 295,

    N6_MIN_X = 402, N6_MAX_X = 462,
    N6_MIN_Y = 255, N6_MAX_Y = 295,

    N7_MIN_X = 470, N7_MAX_X = 530,
    N7_MIN_Y = 255, N7_MAX_Y = 295,

    N8_MIN_X = 538, N8_MAX_X = 598,
    N8_MIN_Y = 255, N8_MAX_Y = 295,

    N9_MIN_X = 606, N9_MAX_X = 666,
    N9_MIN_Y = 255, N9_MAX_Y = 295,

    N0_MIN_X = 674, N0_MAX_X = 734,
    N0_MIN_Y = 255, N0_MAX_Y = 295,
};

// 字母键盘区域边界:按键宽60，高40，按键距离68
enum class AlphaKeys 
{
    // 第一行（Q-P）
    Q_MIN_X = 26,   Q_MAX_X = 86,
    Q_MIN_Y = 293,  Q_MAX_Y = 333,

    W_MIN_X = 94,   W_MAX_X = 154,
    W_MIN_Y = 293,  W_MAX_Y = 333,

    E_MIN_X = 162,  E_MAX_X = 222,
    E_MIN_Y = 293,  E_MAX_Y = 333,

    R_MIN_X = 230,  R_MAX_X = 290,
    R_MIN_Y = 293,  R_MAX_Y = 333,

    T_MIN_X = 298,  T_MAX_X = 358,
    T_MIN_Y = 293,  T_MAX_Y = 333,

    Y_MIN_X = 366,  Y_MAX_X = 426,
    Y_MIN_Y = 293,  Y_MAX_Y = 333,

    U_MIN_X = 434,  U_MAX_X = 494,
    U_MIN_Y = 293,  U_MAX_Y = 333,

    I_MIN_X = 502,  I_MAX_X = 562,
    I_MIN_Y = 293,  I_MAX_Y = 333,

    O_MIN_X = 570,  O_MAX_X = 630,
    O_MIN_Y = 293,  O_MAX_Y = 333,

    P_MIN_X = 638,  P_MAX_X = 698,
    P_MIN_Y = 293,  P_MAX_Y = 333,

    // 第二行（A-L）
    A_MIN_X = 62,   A_MAX_X = 122,
    A_MIN_Y = 337,  A_MAX_Y = 377,

    S_MIN_X = 130,  S_MAX_X = 190,
    S_MIN_Y = 337,  S_MAX_Y = 377,

    D_MIN_X = 198,  D_MAX_X = 258,
    D_MIN_Y = 337,  D_MAX_Y = 377,

    F_MIN_X = 266,  F_MAX_X = 326,
    F_MIN_Y = 337,  F_MAX_Y = 377,

    G_MIN_X = 334,  G_MAX_X = 394,
    G_MIN_Y = 337,  G_MAX_Y = 377,

    H_MIN_X = 402,  H_MAX_X = 462,
    H_MIN_Y = 337,  H_MAX_Y = 377,

    J_MIN_X = 470,  J_MAX_X = 530,
    J_MIN_Y = 337,  J_MAX_Y = 377,

    K_MIN_X = 538,  K_MAX_X = 598,
    K_MIN_Y = 337,  K_MAX_Y = 377,

    L_MIN_X = 606,  L_MAX_X = 666,
    L_MIN_Y = 337,  L_MAX_Y = 377,

    // 第三行（Z-X）
    Z_MIN_X = 94,  Z_MAX_X = 154,
    Z_MIN_Y = 385,  Z_MAX_Y = 425,

    X_MIN_X = 162,  X_MAX_X = 222,
    X_MIN_Y = 385,  X_MAX_Y = 425,

    C_MIN_X = 230,  C_MAX_X = 290,
    C_MIN_Y = 385,  C_MAX_Y = 425,

    V_MIN_X = 298,  V_MAX_X = 358,
    V_MIN_Y = 385,  V_MAX_Y = 425,

    B_MIN_X = 366,  B_MAX_X = 426,
    B_MIN_Y = 385,  B_MAX_Y = 425,

    N_MIN_X = 434,  N_MAX_X = 494,
    N_MIN_Y = 385,  N_MAX_Y = 425,

    M_MIN_X = 502,  M_MAX_X = 562,
    M_MIN_Y = 385,  M_MAX_Y = 425,
};

// 功能键区域边界
enum class FunctionKeys 
{
    // 功能键区
    LowerCase_MIN_X = 26,      LowerCase_MAX_X = 86,
    LowerCase_MIN_Y = 385,    LowerCase_MAX_Y = 425,

    UpperCase_MIN_X = 570,    UpperCase_MAX_X = 630,
    UpperCase_MIN_Y = 385,    UpperCase_MAX_Y = 425,

    Enter_MIN_X = 638,        Enter_MAX_X = 698,
    Enter_MIN_Y = 385,        Enter_MAX_Y = 425,

    Delete_MIN_X = 706,       Delete_MAX_X = 766,
    Delete_MIN_Y = 385,       Delete_MAX_Y = 425
};

std::string getKeyFromCoordinates();

#endif // KEYBOARD_H
